package com.hospital.user.ctluo.controller;

import com.github.pagehelper.PageInfo;
import com.hospital.user.ctluo.entity.CtInfo;
import com.hospital.user.ctluo.servlce.impl.ChaServlce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class CtinfoController {

    @Autowired
    ChaServlce servlce;

    /**
     * 分页查询
     *
     * @param curr 起始页数
     * @param id
     * @param name 姓名
     * @return page的分页对象
     */
    @RequestMapping("/findByPage")
    String findByPage(Model model, @RequestParam(value = "curr", defaultValue = "1") Integer curr, Integer id, String name) {
        PageInfo<CtInfo> pageInfo = servlce.findByPage(curr, id, name);
        model.addAttribute("page", pageInfo);
        model.addAttribute("id", id);
        model.addAttribute("name", name);
        return "dept/chaCt";
    }

    //哈哈哈
}
